package com.wzy.orderSystem.controller;

import com.wzy.orderSystem.pojo.order;
import com.wzy.orderSystem.service.impl.opOrderImpl;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

public class orderController {
    private static opOrderImpl ool = new opOrderImpl();

    //根据角色id 查询角色信息
    public static void selectById(int id) throws SQLException {
        List<order> orders = ool.selectById(id);
        for(order o: orders){
            System.out.println("订单id为"+id+"的信息如下：");
            System.out.println("订单号id为："+o.getId());
            System.out.println("订单菜品号id为："+o.getFoodId());
            System.out.println("订单顾客名为："+o.getCustomName());
            System.out.println("订单顾客电话为："+o.getPhone());
            System.out.println("订单顾客定的菜品为："+o.getFood());
            System.out.println("订单顾客定的菜品数量为："+o.getFoodNum());
            System.out.println("订单顾客定的菜品备注为："+o.getFoodMark());
            System.out.println("订单顾客定的菜品时间为："+o.getFood_date());
            System.out.println("订单顾客地址为："+o.getFoodAddress());
            System.out.println("订单顾客总计消费为："+o.getFoodMoney());
            System.out.println("订单状态为："+o.getFoodState());
        }
    }

    //根据角色id修改角色名
    public static void updateById(int id,String foodState){
        int i = ool.updateById(id, foodState);
        System.out.println(i>0?"修改成功！":"修改失败");
    }

    //根据角色id删除角色
    public static void deleteById(int id){
        int i = ool.deleteById(id);
        System.out.println(i>0?"删除成功！":"删除失败");
    }

    //增加角色
    public static void insert(int id, int foodId, String customName, int phone, String food, int foodNum, String foodMark, Date foodDate, String address, String foodMoney, String foodState){
        int i = ool.insert(id,foodId,customName,phone,food,foodNum,foodMark,foodDate,address,foodMoney,foodState);
        System.out.println(i>0?"新增成功！":"新增失败");
    }
}
